import ajax from './index'
// 后台菜单管理
// 新增菜单
export function menuCreate(obj) {
  return ajax({
    url: '/backend/menu/create',
    method: 'post',
    data: obj
  });
}
// 修改菜单
export function menuUpdate(obj) {
  return ajax({
    url: `/backend/menu/update/${obj.id}`,
    method: 'post',
    data: obj
  });
}
// 获取菜单详情
export function menuInfo(id) {
  return ajax({
    url: `/backend/menu/${id}`,
    method: 'get'
  });
}
// 删除菜单
export function menuDelete(id) {
  return ajax({
    url: `/backend/menu/delete/${id}`,
    method: 'post'
  });
}
// 通过父级id获取菜单列表
export function menuList(parentId) {
  return ajax({
    url: `/backend/menu/list/${parentId}`,
    method: 'get'
  });
}
// 菜单树列表
export function treeList(obj) {
  return ajax({
    url: '/backend/menu/treeList',
    method: 'get',
    data: obj
  });
}
// 获取全部菜单 
export function getAllMenu(obj) {
  return ajax({
    url: '/backend/menu/allList',
    method: 'get',
    data: obj
  });
}
// 修改隐藏状态
export function updateHidden(obj) {
  return ajax({
    url: `/backend/menu/updateHidden/${obj.id}`,
    method: 'post',
    data: obj
  });
}

